package tx.test;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import tx.dao.PhoneDao;
import tx.service.PhoneService;

/**
 * @author ddy
 * @create 2020-08-17 09:50:07
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations="classpath:tx.xml")
public class TextTx {

    /*@Test
    public void testPhoneDao() {
        ApplicationContext ioc = new ClassPathXmlApplicationContext("tx.xml");
        PhoneDao phoneDao = ioc.getBean(PhoneDao.class);

        int price = phoneDao.findPriceById("1001");
        System.out.println(price);
    }*/


    @Autowired
    private PhoneService phoneService;

    @Test
    public void test01() {
        phoneService.purchase("孙悟空","1001");
    }


}
